<?php
namespace app\before\validate;

use think\Validate;

class AdBuy extends Validate
{
    protected $rule = [
        'user_id' => 'require|number',
        'foreign_key' => 'require|number',
        'position_id' => 'require|number',
        'price' => 'require|number',
        'role' => 'require',
        'buy_num' => 'require|number',
        'end_time' => 'require|number',
        'status' => 'require',
        'order_no' => 'require',
        'tran_no' => 'require',
        'pay_type' => 'require',
        'pay_time' => 'require|number',
        'image' => 'require',
        'name' => 'require',
        'city' => 'require',
        'add_time' => 'require|number',
    ];
    protected $message = [
        'user_id.require' => '购买人ID为必填项',
        'user_id.number' => '购买人ID需为数字',
        'foreign_key.require' => '广告位ID为必填项',
        'foreign_key.number' => '广告位ID需为数字',
        'position_id.require' => '广告位id为必填项',
        'position_id.number' => '广告位id需为数字',
        'price.require' => '支付金额为必填项',
        'price.number' => '支付金额需为数字',
        'role.require' => '用户角色  0：前台会员  1：后台代理为必填项',
        'buy_num.require' => '购买天数为必填项',
        'buy_num.number' => '购买天数需为数字',
        'end_time.require' => '广告到期时间为必填项',
        'end_time.number' => '广告到期时间需为数字',
        'status.require' => '状态 0:未支付 1：已支付 2：已下架为必填项',
        'order_no.require' => '内部订单号为必填项',
        'tran_no.require' => '交易号为必填项',
        'pay_type.require' => '支付方式  0：余额 1：微信 2：支付宝为必填项',
        'pay_time.require' => '支付方式为必填项',
        'pay_time.number' => '支付方式需为数字',
        'image.require' => '图片为必填项',
        'name.require' => '名称为必填项',
        'city.require' => '城市编码为必填项',
        'add_time.require' => '下单时间为必填项',
        'add_time.number' => '下单时间需为数字',
    ];
    protected $scene = [
        'edit' => [
            'user_id',
            'foreign_key',
            'position_id',
            'price',
            'role',
            'buy_num',
            'end_time',
            'status',
            'order_no',
            'tran_no',
            'pay_type',
            'pay_time',
            'image',
            'name',
            'city',
            'add_time',
        ],
    ];
}
